<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>查看异常节点</title>
    <script src="../../../static/kaige/js/szload.js"></script>
</head>

<body>
    <div class="kaige-body">
        <table class="layui-hide" id="pageTable" lay-filter="pageTable"></table>
    </div>
    <script>
        load_init_js(function () {
            layui.use(['table', 'form', 'layer', 'laydate', 'element'], function () {
                var layer = layui.layer, table = layui.table, form = layui.form, laydate = layui.laydate, element = layui.element;
                //执行渲染
                table.render({
                    elem: '#pageTable',
                    height: 'full-10',
                    id: 'pageTable',
                    url: "/sys.menu/getabnormal",
                    cols: [[
                        { type: 'numbers' },
                        { field: 'node', title: '节点', width: 300 },
                        { field: 'menu_id', title: '菜单ID', align: 'center', width: 160 },
                        { field: 'p_menu_id', title: '菜单父ID', align: 'center', width: 150 },
                        {
                            field: 'menu_type', title: '类型', align: 'center', width: 100, template: function (d) {
                                str = "";
                                switch (d.menu_type) {
                                    case 1:
                                        str = "父菜单";
                                        break;
                                    case 2:
                                        str = "子菜单";
                                        break;
                                    case 3:
                                        str = "按钮";
                                        break;
                                    case 4:
                                        str = "接口";
                                        break;
                                    case 5:
                                        str = "系统";
                                        break;
                                    default:
                                        str = "无";
                                        break;
                                }
                                return str;
                            }
                        },
                        { field: 'is_menu', title: '是否菜单', align: 'center', width: 110, templet: '#is_menu_td' },
                        { field: 'is_sys', title: '操作是否保留', align: 'center', width: 180, templet: '#is_sys_td' }
                    ]]
                });

                form.on('switch(is_sys)', function (obj) {
                    var othat = $(obj.othis);
                    $.post("/sys.menu/updatefield", { id: obj.value, field: 'is_sys', value: obj.elem.checked ? 1 : 0 }, function (res) {
                        layer.tips(res.msg, othat[0], { tips: 4 });
                    });
                });

            });
        });
    </script>
    <script type="text/html" id="is_sys_td">
        <input type="checkbox" name="is_sys" value="{{d.id}}" lay-skin="switch" lay-text="继续保留|废弃可清理" lay-filter="is_sys" {{ d.is_sys == 1 ? 'checked' : '' }}>
    </script>
    <script type="text/html" id="is_menu_td">
        <i class="fa {{ d.is_menu==1 ? 'fa-toggle-on' : 'fa-toggle-off' }}"></i>
    </script>
</body>

</html>
